Vector quantizer

ABSTRACT

Vector Quantizer and method therein for vector quantization, e.g. in a transform audio codec. The method comprises comparing an input target vector with four centroids C0, C1, C0,flip and C1,flip, wherein centroid C0,flip is a flipped version of centroid C0 and centroid C1,flip is a flipped version of centroid C1, each centroid representing a respective class of codevectors. A starting point for a search related to the input target vector in the codebook is determined, based on the comparison. A search is performed in the codebook, starting at the determined starting point, and a codevector is identified to represent the input target vector. A number of input target vectors per block or time segment is variable. A search space is dynamically adjusted to the number of input target vectors. The codevectors are sorted according to a distortion measure reflecting the distance between each codevector and the centroids C0 and C1.

CROSS REFERENCE TO RELATED APPLICATIONS

This present application claims priority under 35 U.S.C. § 120 as acontinuation of U.S. patent application Ser. No. 16/549,270, filed Aug.23, 2019, which is a continuation of U.S. patent application Ser. No.15/805,768, filed Nov. 7, 2017 (now U.S. Pat. No. 10,468,044), which isa continuation of U.S. patent application Ser. No. 15/187,943, filedJun. 21, 2016 (now U.S. Pat. No. 9,842,601), which is a continuation ofU.S. patent application Ser. No. 14/387,716, filed Sep. 24, 2014 (nowU.S. Pat. No. 9,401,155), which is a 35 U.S.C. § 371 national stageapplication of PCT International Application No. PCT/SE2012/051381,filed Dec. 12, 2012, which itself claims priority to U.S. provisionalPatent Application No. 61/617,151, filed Mar. 29, 2012, the disclosuresand contents of which are incorporated by reference herein in theirentireties. The above-referenced PCT International Application waspublished in the English language as International Publication No. WO2013/147667 A1 on 3 Oct. 2013.

TECHNICAL FIELD

The suggested technology relates generally to vector quantization (VQ),and especially to the accuracy and computational complexity of the same.

BACKGROUND

There are two major classes of quantization algorithms, namely: scalarquantizers (SQs), which process an input vector element by element, andvector quantizers (VQs), which quantize an input vector as one unit (allvector dimensions are quantized jointly). At a given bitrate, VQs aresuperior to the SQs, but at a cost of increased computational complexityand memory storage.

Let the target vector to quantize be M dimensional: s=[s(1) s(2) . . .s(M)]. The VQ algorithm performs a search in a codebook (CB) of size K,{c_(k)}_(k=1) ^(K) of pre-stored M dimensional codevectorsc_(k)=[c_(k)(1) c_(k)(2) . . . c_(k)(M)]. Such a search returns theindex of the codebook vector that provides the best match k^(opt) basedon a distortion measure d(s,c_(k)). Equations (1-2) below describe thisoperation, assuming that the search criterion is based on a squarederror:

$\begin{matrix}{k^{opt} = {\underset{k}{\arg\min}{d\left( {s,c_{k}} \right)}}} & (1)\end{matrix}$ $\begin{matrix}{{d\left( {s,c_{k}} \right)} = {\sum\limits_{m = 1}^{M}\left( {{s(m)} - {c_{k}(m)}} \right)^{2}}} & (2)\end{matrix}$

The optimal index k^(opt) is transmitted to the decoder, and thecorresponding codevector is extracted from the CB (identical CBs areavailable both at the encoder and the decoder) and is used toreconstruct the target vector. The CB is typically trained offline andcaptures the statistical properties of the data. In many cases thesimple squared error (cf. equation (2)) is modified with weights, suchthat:

$\begin{matrix}{{d\left( {s,c_{k}} \right)} = {\sum\limits_{m = 1}^{M}{{w(m)} \cdot \left( {{s(m)} - {c_{k}(m)}} \right)^{2}}}} & (3)\end{matrix}$where the weights w(m) are application dependent. For simplicity of thepresentation herein, only squared error, defined in equation (2) will beused in the further description. However, it should be noted that theprinciples discussed herein are valid also when more sophisticatedcriteria, such as the one in equation (3), are used.

As may be concluded from the description above, the accuracy or qualityof the reconstructed target signal is dependent on the size K of thecodebook; where a large CB leads to higher accuracy, and thus betterquality, than a smaller CB. At the same time, from equation (1) it maybe concluded that the main computational complexity also is related tothe size of the CB, assuming that the vector dimensionality is fixed bythe application.

Typically, audio transmission systems are built under the constraints oflimited computational complexity. That is, the worst case complexityshould not exceed a certain pre-defined level L_(MAX). For example, thecomputational complexity of an audio codec is typically measured bymeans of Weighted Millions of Operations per Second (WMOPS), but as weconsider a VQ module, the complexity is directly related to the size ofthe search space (size of the CB). A VQ is typically the most complexmodule in a codec, and further, the CB search (number of comparisonswith CB vectors) is what makes the VQ so complex.

If a VQ system is to quantize one target vector s at a time, the searchspace K has to be optimized such that complexity does not exceedL_(MAX). Some off-line optimization techniques, such as split andmulti-stage VQ can provide certain reduction of complexity (andstorage), given the properties of vector S and the quality requirementsfor the reconstructed vector.

If the VQ system is to quantize multiple target (input) vectors{s_(n)}_(n=1) ^(N) at a time, with a varying number of vectors N, theoff-line optimization techniques mentioned above are not capable ofmaintaining complexity and quality constraints. In such cases, theoffline optimization have to find a balance between contradictingrequirements of A) limiting complexity (=limiting the search) when alarge number of input vectors are to be quantized simultaneously, and B)maintaining high accuracy (=search in large codebook) when a low numberof vectors are to be quantized, which is not a simple task.

SUMMARY

The technology described herein is applicable e.g. for audio and videocompression/transmission systems that perform lossy compression on theinput stream, and could be described in a number of different aspects.The herein described technology involves a codebook, which is dividedinto classes and sorted, and the classification of an input targetvector s to be quantized into one of said classes. The herein describedtechnology enables that the class of codevectors, in the codebook, whichcomprises the most probable set of candidate codevectors in regard ofthe input vector s is searched first of the classes in the codebook.Thus, the best match codevector for the input vector s may be foundearly in a search, and the computational complexity may be reduced.

According to a first aspect, a method in a Vector Quantizer is provided.The method comprises comparing an input target vector s with a pluralityof centroids, i.e. reference vectors, where each centroid represents arespective class of codevectors in a codebook. The method furthercomprises determining a starting point, in a codebook, for a searchrelated to the input target vector in the codebook, where the startingpoint is determined based on the result of the comparison. Thecodevectors in the codebook are sorted according to a distortion measurereflecting the distance between each codevector and the centroids. Themethod enables that the class of codevectors, in the codebook, whichcomprises the most probable set of candidate codevectors in regard ofthe input vector s is searched first of the classes in the codebook.

According to a second aspect, a Vector Quantizer is provided, comprisingfunctional units adapted to execute the method according to the firstaspect. The Vector Quantizer comprises a comparing unit adapted tocompare an input target vector s with a plurality of centroids, eachcentroid representing a respective class of codevectors in a codebook.The Vector Quantizer further comprises a determining unit adapted todetermine a starting point for a search in the codebook, based on theresult of the comparison. The codevectors in the codebook are sortedaccording to a distortion measure reflecting the distance between eachcodevector and the centroids. The Vector Quantizer enables that theclass of codevectors comprising the most probable candidate codevectorsin regard of the input vector s are searched first of the classes in thecodebook.

According to a third aspect, a codec is provided, which comprises aVector Quantizer according to the second aspect.

According to a fourth aspect, a mobile terminal is provided, whichcomprises a Vector Quantizer according the second aspect above.

According to a fifth aspect, a codebook for vector quantization isprovided, which codebook is arranged such that the codevectors of thecodebook are divided into a plurality of classes, each represented by acentroid, and where the codevectors further are sorted according to adistortion measure reflecting their distance to the centroids of theplurality of classes. The codevectors may be sorted according to e.g.descending or increasing distortion value.

According to a sixth aspect, a use of a codebook for vector quantizationis provided, which codebook is arranged such that the codevectors of thecodebook are divided into a plurality of classes, each represented by acentroid, and where the codevectors further are sorted according to adistortion measure reflecting their distance to the centroids of theplurality of classes. The codevectors may be sorted according to e.g.descending or increasing distortion value.

According to a seventh aspect, a computer program is provided,comprising computer readable code, which when run in a processing unit,causes a Vector Quantizer to perform a method according to the firstaspect.

According to an eight aspect, a computer program product is provided,comprising a computer readable medium and a computer program accordingto the sixth aspect, stored on the computer readable medium.

The size of a search region in the codebook, in which a search isperformed, may be adapted based on a number of input target vectors anda maximum complexity constraint. The number of input target vectors percoding unit may be variable. Further, the maximum complexity constraintmay be set dynamically. Further, a search could be performed in thecodebook in the determined search space, starting at the determinedstarting point, where the search delivers a best match to the inputtarget vector s. By “best match” is here meant the closest match,shortest distance, in regard of a distance measure between the inputtarget vector and a candidate vector in the codebook, i.e. a best matchis a code vector which has the shortest distance to the input targetvector, according to the distance measure.

A fifth aspect may be a codec comprising a vector quantizer according tothe second aspect.

A sixth aspect may be a mobile terminal comprising a vector quantizeraccording to the second aspect.

BRIEF DESCRIPTION OF THE DRAWINGS

The suggested technology will now be described in more detail by meansof exemplifying embodiments and with reference to the accompanyingdrawings, in which:

FIGS. 1 a and 1 b show the structure of an ordered CB according to asolution described herein. The search starts from point 0 or point 1towards the other end of the CB.

FIG. 2 shows an exemplifying CB structure exploiting symmetry. Onlycodevectors of C₀ and C₁ are stored in a ROM memory.

FIG. 3 illustrates an exemplifying functional unit for determining anoptimal class for an input vector S by comparing the input vector S toeach of a number of centroids {C₀ C₁ C_(1,flip) C_(0,flip)}, eachassociated with a class in a codebook.

FIG. 4 illustrates a functional unit for determining a size of a searchregion in a codebook based on a number of spectral peaks detected in acurrent frame, and possibly on the codec's bitrate.

FIG. 5 is a table illustrating that a search region increases as thenumber of peaks per-frame decrease. In the example; with 17 peaks (=17input vectors) the search is performed only in 7-bit CB (defined to bethe minimum search space in this example), but with 8 peaks or less, thesearch is performed in 8-bit CB (maximum search space), since this canbe “afforded” under the maximum complexity constraint.

FIGS. 6 a-d show examples of different search regions.

FIG. 7 illustrates that the allowed complexity L_(MAX) may be signaledto the system from an external entity. The parameter L_(MAX) could bebased on e.g. CPU load, or battery status.

FIG. 8 is a flow chart illustrating the actions in a procedure forcreating a codebook, CB, to be used in the suggested technology.

FIGS. 9 a-c are a flow charts illustrating actions in procedures forvector quantization, VQ, according to examples of the herein suggestedtechnology.

FIG. 10 is a block diagram illustrating a vector quantizer, according toan example of the herein suggested technology.

FIG. 11 is a block diagram illustrating a codec comprising a vectorquantizer, according to an example of the herein suggested technology.

FIG. 12 is a block diagram illustrating an arrangement for vectorquantization, according to an example of the herein suggestedtechnology.

DETAILED DESCRIPTION

Briefly described, the solution described herein relates to dynamicallyadapting the search space of a VQ, such that, for any number of target(input) vectors (per block or time interval), a high accuracy, and thusquality, quantization is achieved within a given complexity constraint.That is, the requirements of computational complexity (cf. L_(max)) arenot to be violated. This is achieved by that the search is performed ina special classified and ordered CB. The starting point in the searchspace for each target vector is based on a classification procedure, andthe size of the search space is increased or reduced, based on thenumber of target vectors. The VQ algorithm described herein may beregarded as a “tool” for data compression, independent of what the datais, i.e. the data could be e.g. video and/or audio. In this description,the VQ is described in the context of an audio codec, but the conceptdescribed herein is not limited to audio codecs. For example, it couldalso be implemented in video codecs.

The algorithm described herein is based on a specially designed CB. Somevariants of such a codebook will be described in more detail below.First a basic case will be described, and further below a more advancedscheme will be discussed. The codevectors of the CB may be arrangedaccording to the solution described herein in an offline mode.

In order to create a basic version of the specially designedadvantageous CB, the codevectors of a CB are split into two classes,here denoted C₀ and C₁ (this notation will be used both for the names ofthe classes, as well as for the corresponding centroids, cf. FIG. 1 ).To partition data into two classes a so-called K-means algorithm(Generalized Lloyd's algorithm) may be used. It is a well knowntechnique, which takes an entire data set as input, and the desirednumber of classes, and outputs the centroids of the desired number ofclasses. For example, the algorithm outputs 2 centroid vectors if thedesired number of classes have been indicated to 2. Note that thesecentroids, when using a K-means algorithm, are vectors of the samedimension as the vectors from the data set, but they do not belong tothe data set. That is, the centroid vectors are outside the CB and donot need to coincide with some existing codevectors. By “centroid” isherein generally meant a reference vector representing a class ofvectors.

All codevectors in the CB are then sorted according to a distortionmeasure, e.g. as the one defined in equation (4)

$\begin{matrix}{{d\left( {c_{k},C_{0},C_{1}} \right)} = {{\sum\limits_{m = 1}^{M}\left( {{s_{k}(m)} - {C_{0}(m)}} \right)^{2}} - {\sum\limits_{m = 1}^{M}\left( {{s_{k}(m)} - {C_{1}(m)}} \right)^{2}}}} & (4)\end{matrix}$

The distortion measure above results in, or assumes, large negativevalues for codevectors close to C₀, and large positive values forcodevectors close to C₁. The codevectors which are equally distancedfrom the centroids (C₀ and C₁) of the two classes produce a distortionmeasure d which is close to zero. In the CB the codevectors are orderede.g. by increasing distortion measure, as illustrated in FIGS. 1 a andb.

Each input target vector is compared with the two centroids (therespective centroid of the two classes) and is, depending on the result,assigned to, i.e. concluded or determined to belong to, either class C₀or class C₁. Based on that classification, the starting point of thesearch is either selected to be the most upper point (FIG. 1 a ) or mostleft (FIG. 1 b ) point 0 (when the target vector belongs to class C₀) orthe lowest point (FIG. 1 a ) or most right (FIG. 1 b ) point 1 (when thetarget vector belongs to class C₁). Now, the size of the search spaceshould be made dependent on the number of input target vectors N perblock or time segment/interval. If we re-define the search space K notto be the size of the entire CB, but to be variable, the concept behindthe adaption described herein may be defined in equation (5):N×K≈const  (5)

In other words #Quantizers×#Operations_per_Quantizer≈const, where“Quantizer” may be regarded as the algorithm that maps an input vectorto one of the codevectors.

Herein, as an example, the VQ is described in a context of a transformcodec which encodes spectral peaks, or strictly, the regions aroundspectral peaks. In the context of such a codec, an input target vectormay reflect a spectral peak (region) of a segment of the audio signalbeing processed. The number of spectral peaks in the signal spectrum ofa time segment, e.g. 30 ms, of an audio signal depends on the spectralproperties of the audio signal in that time segment. Since the spectralproperties of an audio signal may vary over time and is different e.g.for different types of audio, the number of spectral peaks may varybetween different time segments and between different audio signals.Thus, when using a transform encoder which encodes spectral peakregions, the number of input vectors, per block or time segment, to theVQ will vary. In the examples herein, the maximum number of inputvectors, corresponding to a number of spectral peaks in a time segmentof an audio signal, is 17. However, this number is only an example, andshould not be interpreted as limiting the solution in general.

Effectively, the scheme described above keeps the number of operationsrequired for the VQ in a narrow range (or almost constant); that is,when the number of VQs increases, i.e. number of input target vectorsincreases, the number of operations per-VQ decreases (the size of thesearch space decreases/only part of the CB is searched), such that thecomplexity requirements (i.e. constraints) are not violated. With adecrease of N, the search space K may be increased, at most up to thesize of the entire CB, which leads to higher accuracy and thus qualityof the reconstructed vector. The accuracy of a vector quantizer may bemeasured as a squared error between an original signal and correspondingreconstructed data.

In this way, the codebook of the VQ need not be designed for the worstcase scenario (i.e. maximum number of input target vectors). Instead, itcould be designed e.g. for a best case scenario, thus comprising morecodevectors than could possibly be searched for the maximum number ofinput target vectors within the maximum complexity constraint L_(MAX).The maximum complexity requirement will be fulfilled by that the extentof the search, i.e. the size of search space, in the CB depends on thenumber of input target vectors. However, if this would be done“blindly”, e.g. without the herein suggested CB, the quality of thequantization would suffer greatly, since there would be no way to knowwhere the “best match” vector is located in the CB, or whether this bestmatch vector is located in a part of the codebook that will be searchedwhen the search space is reduced. This problem is solved by the specialdesign of the codebook, which is described herein. It should be notedthat the CB design described herein is beneficial also for applicationswhere the number of input vectors, per coding unit, is constant.

Exemplifying Embodiment 1: Constrained VQ on Spectral Peaks Regions

A set of target vectors s represent spectral peak regions in atransform-domain audio coding, e.g., transform coefficients in theneighborhood of MDCT peaks. Thus, in this context, the number of targetvectors varies over time, since the number of spectral peaks varies fromone time-block to another.

In this type of application (peak region encoding), the target vectors sexhibit certain symmetries that can be used to further optimize the CB.For example, the transform coefficients on both sides of a spectral peakhave similar statistics. If we assume that the target vectors s arecentered at the peak position, the symmetry described above allowsadding further structure in the ordered CB from FIGS. 1 a and 1 b . Thestructure of such a new, further improved CB is illustrated in FIG. 2 .FIG. 2 illustrates a CB where the codevectors of the left part arestored in a memory, such as a Read Only Memory. However, there are nocodevectors pre-stored for the right side of the CB, i.e. for theclasses C_(1,flip) and C_(0,flip). The codevectors of these classes areflipped versions of the codevectors of the right side of the CB. Thus,when performing a search in the classes C_(0,flip) and C_(1,flip), thesearch is performed on the codevectors of the left side, which arestored in memory, but with the elements of the codevectors flippedaround the center, such that the codevectors C_(k,flip) are given byequation (6)c _(k,flip)=[c _(k)(M)c _(k)(M−1) . . . c _(k)(1)],  (6)where c_(k)(m) are the vector elements of the corresponding class C_(j)in the stored CB (i.e. C₀ or C₁). That is, if the elements of a certaincodevector in C₀ are {C₀₁ C₀₂ C₀₃ C₀₄}, the elements of a correspondingcodevector in C_(0, flip) are {C₀₄ C₀₃ C₀₂ C₀₁}.

When using a CB as the one illustrated in FIG. 2 , an input targetvector is compared with four centroids and assigned to a class in orderto determine a starting point for the search, i.e. the optimal class forthe input target vector is determined by comparing the input vector S toeach of the centroids {C₀ C₁ C_(1,flip) C_(0,flip)}. This is illustratedin FIG. 3 , where a target vector s is input to a class assigning unit302, which delivers a class indicator, C_(j), as output. The centroidsC_(1,flip) and C_(0,flip) are not stored in a table, but “created” byflipping the elements of the centroids C₀ and C₁. The elements does notneed to be literally flipped, instead a modified search operation mayread the elements of C₀ and C₁ in the reverse order when readingC_(0,flip) and C_(1,flip), i.e. both centroids and codebook vectors. Inthis way, the CB may be extended to comprising twice the number ofcodevectors, as compared to what is physically stored in the CB, whichmeans saving of memory resources. This is possible due to that thesymmetry of the peak regions is exploited, as described above. Morespecifically, the solution is based on the observation that the symmetrymay be exploited by that a flipped valid codevector also is a validcodevector.

The search region is adapted to the number of spectral peaks, whichcorresponds to the number of input target vectors. This is exemplifiedin FIG. 4 , which shows a functional unit 402 taking an indicator of anumber of peaks/vectors as input, and producing an indicator of a searchregion as output. FIG. 4 further illustrates that e.g. the bitrate of acodec applying the VQ could be taken into consideration when determiningthe search region (search space). For example, there may be differentquality requirements for different bitrates, e.g. the higher thebitrate, the higher the expected quality. Further, the allowed maximumcomplexity may change with the bitrate, e.g. since at different bitratesdifferent modules in a codec are activated, which are not equallycomplex, i.e. the remaining allowed complexity for the VQ, from amaximum complexity constraint on the whole coding procedure, might notbe the same. That is, the bitrate information reflects changes inquality and complexity requirements, which may be taken intoconsideration in the vector quantization.

The table in FIG. 5 illustrates how the search region is adapted to thenumber of peaks. In FIG. 5 , the search region is indicated as thenumber of coefficients (codevectors) in the search per input vector. Thenumbers in the table in FIG. 5 are derived under the assumption that theCB from FIG. 2 comprises four 7-bit segments (four segments with 128codevectors each) of which two are “normal” or “physical” and two are“flipped” or “virtual”).

The logic behind the table in FIG. 5 is that when there is one less peakto code, e.g. 16 instead of 17, the “saved” 128 comparisons may bedistributed among the remaining peaks. At some point the search lengthsaturates because it reaches the physical size of the CB. In the exampleillustrated in FIG. 5 , this point is reached when the number of peaksis 8 or less. That is, in the example illustrated in FIG. 5 , when thenumber of peaks is 8 or less, a full search could be made for all theinput target vectors (i.e. peaks) without reaching the maximum allowedcomplexity.

Examples of the search procedure are illustrated in FIGS. 6 a-d . Inpractice, it is the same type of search as the one described earlier inconjunction with FIGS. 1 a-b , but with additional classification into“normal” and “flipped” CB segments/classes.

In the example shown in FIG. 6 a , the input vector s belongs to classC₁ (position indicated with down arrow). The search space is thenlimited to sizes between the class C₁ only, and the joint space of theclasses C₀ and C₁. In FIG. 6 a , this is illustrated with three brokenarrows indicating search spaces of different sizes. FIG. 6 b illustratesthe case where an input vector belongs to class C₀ (position indicatedwith down arrow), in which case the search has a different startingpoint.

Analogously, as illustrated in FIGS. 6 c-d , the search can be performedin classes C_(1,flip) and/or C_(0,flip) if the input vector belongs toone of these classes. No searches are performed in the joint space of C₁and C_(1,flip). The reason for this is that the joint space of a regularand a flipped class does not correspond to a real data set (itsstatistics do not correspond to real data statistics). Thus, it is notvery likely that a good match could be found for an input vector in sucha space.

Exemplifying Embodiment 2: Communication System with External Control ofMaximum Allowed Complexity

The concept of a VQ having a complexity which is dynamically adjusted tothe number of target vectors N can be extended to the case when thecomplexity limit is not pre-determined, but may vary e.g. based on somecriterion, and be signaled to the VQ and/or to the entity in which theVQ is applied. This is illustrated in the schematic block-diagram inFIG. 7 , which shows a functional unit 702 taking an indicator or thenumber of peaks/vectors as input, and further taking a complexityconstraint L_(MAX) as input. The functional unit 702 delivers anindicator of a search space/a region of the CB, cf. the broken arrows inFIGS. 6 a -d.

The herein presented VQ algorithm with adjustable complexity gives theoptimal balance between accuracy of quantization (i.e. quality) andmaintaining computational complexity below a pre-defined threshold.

Exemplifying Procedure for Achieving CB Structure

An exemplifying procedure for designing or organizing a CB for use in aVQ will be described below, with reference to FIG. 8 . The procedure isfor creating a CB for use in a VQ providing quantization in a transformaudio encoder, such as e.g. an MDCT encoder.

The procedure described below relates to the parts of a CB creationprocedure which deviate from, and/or are additional to, a conventionalVQ CB creation or organization.

The CB is divided into classes in an action 802, e.g. by use of aso-called K-means algorithm, as previously described. The codevectors ofthe CB are then sorted in the CB based on a distortion measure, e.g. asthe one described in equation (4). The distortion measure for eachcodevector depends on a relation between the codevector and centroidsrepresenting each class of the CB, as previously described.

This organization of the CB enables adaptation of the search space, andthus of the search complexity in VQ, at a highly preserved VQ quality(e.g. quality of the reconstructed target vectors).

Exemplifying VQ Procedure

An exemplifying procedure in a vector quantizer (VQ) will be describedbelow, with reference to FIG. 9 a . The procedure is suitable for use ina transform audio encoder, such as e.g. an MDCT encoder encoding e.g.spectral peak regions. The audio signal could comprise e.g. speechand/or music.

A number N of input target vectors are received by the VQ, as previouslydescribed. Below, the actions associated with one of the input targetvectors will be described, for reasons of simplicity.

An input target vector s is compared with a number of codevectors eachrepresenting a CB class (cf. classes C₀ and C₁, etc. described earlier),preferably the centroid of each class. The comparison is illustrated asaction 902 in FIGS. 9 a-c . Action 902 could alternatively be regardedas integrated with an action 904, illustrated in FIG. 9 c . Depending onthe result of the comparisons, the input target vector s is assigned oneof the classes, or sections, of the CB, in an action 904. The inputtarget vector s is assigned, or concluded to belong to, the class towhich it has the shortest distance, i.e. to which it is most similar,according to some distance measure (error measure). The starting pointof the search in the CB is determined in an action 906, based on theclass assignment or distance measure.

A search may be performed in the codebook in an action 910. The searchis initiated in the selected starting point, and is performed over asearch space, which may be of a determined size, comprising one or moreclasses, or parts thereof. Due to the advantageously designed andorganized CB, the probability of that the best match, of all candidatecodevectors within the whole CB, for the input target vector s will befound within the search space is very high, even when the search spaceis limited to e.g. half the CB. In a case where the search space wouldcomprise the entire codebook, the best match codevector would be foundearly in the search when starting the search at the determined startingpoint.

When the best match within the determined search space is found, theindex of the best match codevector is provided, as a result from the VQ,in an action 912, e.g. for use in an audio decoder.

Further, the size of the search space may be determined in an action 908illustrated in FIG. 9 c . The search space may be described as thenumber of codevectors in the CB that should be evaluated in search forthe best match for the input target vector s. The size of the searchspace is determined based on the number of input target vectors and aconstraint on computational complexity L_(MAX). Thus, the size of thesearch space can be determined e.g. once for every coding block, or someother time interval, depending e.g. on the characteristics of the signalto be quantized and/or the attributes of a codec. If the number of inputtarget vectors and the constraint L_(MAX) are constant or semi-constantover time, the size of the search space may also be kept constant overthe corresponding time.

Then, Exemplifying VQ Arrangement

Below, an exemplifying VQ arrangement suitable for use in a transformencoder/codec will be described with reference to FIG. 10 . Thetransform codec could be e.g. an MDCT codec. The VQ is adapted toperform the actions of the procedure described above.

The VQ 1001 is illustrated as to communicate with other entities (e.g.audio codec) via a communication unit 1002. The VQ may further compriseother functional units 1018, such as e.g. functional units providingregular functions, and may further comprise one or more storage units1016.

The VQ 1001 could be implemented e.g. by one or more of: a processor ora microprocessor and adequate software with suitable storage therefore,a Programmable Logic Device (PLD) or other electronic component(s)and/or circuits.

The communication unit 1002 is assumed to comprise functional units forobtaining the adequate parameters, such as input target vectors andL_(MAX), provided e.g. from an encoding entity.

The VQ may comprise a comparison unit 1004, which is adapted to comparean input target vector s with vectors representing each class of the CB,e.g. the centroid vector of each class. Further, the VQ may comprise anassigning unit 1006, which is adapted to assign a class to the inputtarget vector s (or assign the vector s to a class), i.e. conclude towhich class the vector belongs, based on the comparison. Further, the VQmay comprise a determining unit 1008, adapted to determine an adequatestarting point for a search in the CB, based on the class assigned tothe vector s. The determining unit may further be adapted to determinethe size of a search space in the CB, based e.g. on a number of receivedinput target vectors and a computational complexity constraint.

Further, the VQ may comprise a search unit 1010, which is adapted toperform a search in the CB, starting at the determined starting pointand searching the determined search space. The search should result inone or more CB indices pointing to the codevector which best matches theinput target vector s. The VQ may further comprise a providing unit1012, which is adapted to provide said index or indices to anotherentity, e.g. to (or for use by) a transform codec.

Exemplifying Arrangement

FIG. 12 schematically shows an embodiment of an arrangement 1200suitable for use in e.g. a transform audio decoder, which also can be analternative way of disclosing an embodiment of the VQ illustrated inFIG. 5 . Comprised in the arrangement 1200 are here a processing unit1206, e.g. with a DSP (Digital Signal Processor). The processing unit1206 can be a single unit or a plurality of units to perform differentsteps of procedures described herein. The arrangement 1200 may alsocomprise the input unit 1202 for receiving signals, such as input targetvectors and indicators of e.g. bitrate and/or complexity constraint; andfurther the output unit 1204 for output signal(s), such as the CBindices for the best match codevectors. The input unit 1202 and theoutput unit 1204 may be arranged as one in the hardware of thearrangement.

Furthermore the arrangement 1200 comprises at least one computer programproduct 1208 in the form of a non-volatile memory, e.g. an EEPROM, aflash memory and a hard drive. The computer program product 1208comprises a computer program 1210, which comprises code means, whichwhen run in the processing unit 1206 in the arrangement 1200 causes thearrangement to perform the actions of a procedure described earlier inconjunction with FIGS. 9 a -c.

Hence, in the exemplifying embodiments described, the code means in thecomputer program 1210 of the arrangement 1200 may comprise a comparisonmodule 1210 a for comparing an input target vector with class centroidsof a CB. The computer program may comprise an assigning module 1210 bfor assigning a class to the input target vector. The computer program1210 may further comprise a determining unit 1210 c for determining astarting point for a search in the CB; and further for determining asearch space or region based on input parameters. The computer program1210 may further comprise a search unit 1210 d for searching the CBaccording to the above. Further, the computer program 1210 may comprisea providing module 1210 e, for providing indices, which are output fromthe search to other entities.

The computer program 1210 is in the form of computer program codestructured in computer program modules. The modules 1210 a-e mayessentially perform the actions of the flow illustrated in any of FIGS.9 a-c to emulate at least part of the VQ 1001 illustrated in FIG. 10 .In other words, when the different modules 1210 a-d are run on theprocessing unit 1206, they correspond at least to the units 1004-1012 ofFIG. 10 .

Although the code means in the embodiment disclosed above in conjunctionwith FIG. 12 are implemented as computer program modules which when runon the processing unit causes the arrangement and/or transform audioencoder to perform steps described above in the conjunction with figuresmentioned above, at least one of the code means may in alternativeembodiments be implemented at least partly as hardware circuits.

While the suggested technology has been described with reference tospecific example embodiments, the description is in general onlyintended to illustrate the concept and should not be taken as limitingthe scope of the technology described herein. The different features ofthe exemplifying embodiments above may be combined in different waysaccording to need, requirements or preference.

The solution described above may be used wherever VQs are applied, e.g.in codecs in devices such as mobile terminals, tablets, computers, smartphones, etc.

It is to be understood that the choice of interacting units or modules,as well as the naming of the units are only for exemplifying purpose,and nodes suitable to execute any of the methods described above may beconfigured in a plurality of alternative ways in order to be able toexecute the suggested process actions.

The functions of the various elements including functional blocks,including but not limited to those labeled or described as “functionalunit”, “processor” or “controller”, may be provided through the use ofhardware such as circuit hardware and/or hardware capable of executingsoftware in the form of coded instructions stored on computer readablemedium. Thus, such functions and illustrated functional blocks are to beunderstood as being either hardware-implemented and/orcomputer-implemented, and thus machine-implemented.

In terms of hardware implementation, the functional blocks may includeor encompass, without limitation, digital signal processor (DSP)hardware, reduced instruction set processor, hardware (e.g., digital oranalog) circuitry including but not limited to application specificintegrated circuit(s) (ASIC), and (where appropriate) state machinescapable of performing such functions.

ABBREVIATIONS

-   -   SQ Scalar Quantization    -   VQ Vector Quantization    -   CB Codebook    -   WMOPS Weighted Millions of Operations Per Second    -   MDCT Modified Discrete Cosine Transform

The invention claimed is:
 1. A method performed by a transform codeccomprising a vector quantizer, the method comprising: obtaining a numberof input target vectors, wherein the number of input target vectors pertime segment is variable and said number of input target vectorscomprise coefficients derived from an audio signal or a video signal;comparing an input target vector of the number of input target vectorswith at least two centroids C₀, C₁, to determine which of the at leasttwo centroids to assign the input target vector to, each centroidrepresenting a respective class of codevectors; determining a startingpoint in a codebook for a search related to the input target vectorbased on which of the at least two centroids the input target vector wasdetermined to be assigned the input target vector, wherein a searchspace for the search is dynamically adjusted based on the number ofinput target vectors obtained and a computational complexity constraint,and each codevector in a respective class of codevectors is sortedaccording to a distortion measure reflecting a distance between thecodevector and said at least two centroids C₀ and C₁; performing thesearch in the codebook starting at the starting point determined, andidentifying a codevector to represent the input target vector; andperforming an action based on the codevector identified.
 2. The methodaccording to claim 1, further comprising dynamically receiving a changein the computational complexity constraint.
 3. The method according toclaim 1, wherein identifying the codevector to represent the inputtarget vector comprises identifying the codevector based on the searchresulting in one or more codebook indices pointing to a codevector whichbest matches the input target vector.
 4. The method according to claim1, wherein the at least two centroids C₀, C₁ comprise four centroids C₀,C₁, C_(0,flip) and C_(1,flip), wherein centroid C_(0,flip) is a flippedversion of centroid C₀ and centroid C_(1,flip) is a flipped version ofcentroid C₁.
 5. The method according to claim 1, wherein the searchspace is dynamically adjusted by increasing or reducing a size of thesearch space based on the number of input target vectors.
 6. The methodaccording to claim 1, wherein codevectors in the codebook are sortedsuch that codevectors closest to centroid C₀ and most distanced tocentroid C₁ are in one side of the codebook, while codevectors closestto said centroid C₁ and most distanced to said centroid C₀ are clusteredin the other side of the codebook.
 7. The method according to claim 1,wherein the at least two centroids C₀, C₁ comprise four centroids C₀,C₁, C_(0,flip) and C_(1,flip), and codevectors for class C_(0,flip)represented by the centroid C_(0,flip) are flipped versions ofcodevectors for class C₀ represented by the centroid C₀ and codevectorsfor class C_(1,flip) represented by the centroid C_(1,flip) are flippedversions of codevectors for class C₁ represented by the centroid C₁. 8.The method according to claim 5, wherein elements of codevectorsc_(k,flip) in class C_(j,flip) are given by equation:c _(k,flip)=[c _(k)(M)c _(k)(M−1) . . . c _(k(1))], where c_(k)(M) arevector elements of a corresponding class C_(j) and M is a length of thecodevector c_(k,flip) and k is an index of the codevector.
 9. The methodaccording to claim 1 wherein the codebook is created based on said atleast two centroids C₀ and C₁, wherein the at least two centroids C₀, C₁comprise four centroids C₀, C₁, C_(0,flip) and C_(1,flip), wherein saidcentroid C_(0,flip) and said centroid C_(1,flip) are created by readingsaid centroids C₀ and C₁ in reverse order, wherein codevectors for classC₀ represented by centroid C₀ and codevectors for class C₁ representedby centroid C₁ are stored in memory, and codevectors for classC_(0,flip) represented by centroid C_(0,flip) and codevectors for classC_(1,flip) represented by centroid C_(1,flip) are created by dynamicallyreading elements of said codevectors for class C₀ and said codevectorsfor class C₁ in reverse order when reading codevectors for classC_(0,flip) and codevectors for class C_(1,flip).
 10. A transform codeccomprising a vector quantizer comprising: a communication unit, adaptedto obtain a number of input target vectors, wherein the number of inputtarget vectors per time segment is variable and said input targetvectors comprise coefficients derived from an audio signal or a videosignal; a comparing unit, adapted to, for an input target vector of thenumber of input target vectors, compare the input target vector with atleast two centroids C₀, C₁, to determine which of the at least twocentroids to assign the input target vector to, each centroidrepresenting a respective class of codevectors; a determining unitadapted to determine a starting point in a codebook, for the inputtarget vector, for a search in the codebook, based which of the at leasttwo centroids the input target vector was determined to be assigned theinput target vector and to dynamically adjust a search space based onthe number of input target vectors obtained and a computationalcomplexity constraint; a search unit, adapted to, for the input targetvector, perform a search in the codebook starting at the starting pointdetermined, and identify a codevector to represent the input targetvector, wherein each codevector in a respective class of codevectors issorted according to a distortion measure reflecting a distance betweenthe codevector and said at least two centroids C₀ and C₁; and aproviding unit, adapted to perform an action based on the codevectoridentified.
 11. The transform codec according to claim 10, wherein thecommunication unit is further adapted to dynamically receive a change inthe computational complexity constraint.
 12. The transform codecaccording to claim 10, wherein the search unit is adapted to identifythe codevector to represent the input target vector by identifying thecodevector based on the search resulting in one or more codebook indicespointing to a codevector which best matches the input target vector. 13.The transform codec according to claim 10, wherein the at least twocentroids C₀, C₁ comprise four centroids C₀, C₁, C_(0,flip) andC_(1,flip), wherein centroid C_(0,flip) is a flipped version of centroidC₀ and centroid C_(1,flip) is a flipped version of centroid C₁.
 14. Thetransform codec according to claim 10, wherein the determining unit isadapted to dynamically adjust the search space by increasing or reducinga size of the search space based on the number of input target vectors.15. The transform codec according to claim 10, wherein codevectors inthe codebook are sorted such that codevectors closest to centroid C₀ andmost distanced to centroid C₁ are in one side of the codebook, whilecodevectors closest to said centroid C₁ and most distanced to saidcentroid C₀ are clustered in the other side of the codebook.
 16. Thetransform codec according to claim 10, wherein the at least twocentroids C₀, C₁ comprise four centroids C₀, C₁, C_(0,flip) andC_(1,flip), and codevectors for class C_(0,flip) represented by centroidC_(0,flip), are flipped versions of codevectors for class C₀ representedby centroid C₀ and codevectors for class C_(1,flip) represented bycentroid C_(1,flip) are flipped versions of codevectors for class C₁represented by centroid C₁.
 17. The transform codec according to claim16, wherein elements of codevectors c_(k,flip) in class C_(j,flip) aregiven by equation:c _(k,flip)=[c _(k)(M)c _(k)(M−1) . . . c _(k(1))], where c_(k)(M) arevector elements of a corresponding class C_(j) and M is a length of thecodevector c_(k,flip) and k is and index of the codevector.
 18. Thetransform codec of claim 17 wherein the codebook is created based onsaid centroids C₀ and C₁, wherein said centroid C_(0,flip) and saidcentroid C_(1,flip) are created by reading said centroids C₀ and C₁ inreverse order, and the codevectors for said class C₀ and the codevectorsfor said class C₁ are stored in memory, and codevectors for classC_(0,flip) and codevectors for class C_(1,flip) are created bydynamically reading elements of said codevectors for class C₀ and saidcodevectors for class C₁ in reverse order when reading codevectors forclass C_(0,flip) and codevectors for class C_(1,flip).
 19. A Mobileterminal comprising the transform codec according to claim
 10. 20. Anon-transitory computer readable medium storing computer readable code,which when run in a processing unit, causes the vector quantizer toperform operations of claim 1.